#include <stdio.h>
int main(int argc, const char **argv) {
int deviceCount = 0;
cudaGetDeviceCount(&deviceCount);
if(deviceCount == 0)
printf("There is no device support ing CUDA\n");
else if(deviceCount == 1)
printf("There is 1 device support ing CUDA\n");
else
printf("There are %d devices support ing CUDA\n", deviceCount);
for(int dev = 0; dev < deviceCount; ++dev) {
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, dev);
printf("\nDevice %d: \"%s\"\n", dev, deviceProp.name);
printf("CUDA Capability Major/Minor version number:%d.%d\n", deviceProp.major, deviceProp.minor);
printf("Amount of global memory: %d bytes\n", deviceProp.totalGlobalMem);
printf("Amount of constant memory: %d bytes\n", deviceProp.totalConstMem);
printf("Amount of shared memory per block: %d bytes\n", deviceProp.sharedMemPerBlock);
printf("Number of registers per block: %d\n", deviceProp.regsPerBlock);
printf("Warp size: %d\n", deviceProp.warpSize);
printf("Maximum number of threads per block: %d\n", deviceProp.maxThreadsPerBlock);
printf("Maximum thread dim: %d x %d x %d\n",
deviceProp.maxThreadsDim[0],
deviceProp.maxThreadsDim[1],
deviceProp.maxThreadsDim[2]);
printf("Maximum grid size: %d x %d x %d\n",
deviceProp.maxGridSize[0],
deviceProp.maxGridSize[1],
deviceProp.maxGridSize[2]);
printf("Clockrate: %.2f Ghz\n", deviceProp.clockRate * 1e-6f);
}
return 0;
}
